package com.collect.tanzania.zhiScene.zhiWidget.zhiDialog;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

import com.collect.tanzania.R;

public class ZHIDialogQueryCount extends Dialog {

    private TextView tv_total;
    private TextView tv_okrupee;
    private TextView tv_getpaisa;
    private TextView tv_creditfinch;
    private TextView tv_paisafinch;
    private TextView tv_sweetbee;
    private TextView tv_kracycat;
    private TextView tv_nextcredit;

    private int totalCount = 0;
    private int okrupeeCount = 0;
    private int getpaisaCount = 0;
    private int creditfinchCount = 0;
    private int paisafinchCount = 0;
    private int sweetbeeCount = 0;
    private int kracycatCount = 0;
    private int nextcreditCount = 0;

    private Context mContext;

    public ZHIDialogQueryCount(Context context) {
        super(context, R.style.CustomDialog);
        this.mContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_query_count);
        setCanceledOnTouchOutside(true);
        initView();
        initViewEvent();
    }

    @Override
    public void show() {
        super.show();
        refreshViewData();
    }

    /**
     * 初始化界面控件
     *
     * @type method
     * @author liwenjie
     * @creatTime 2019-10-24 13:47
     */
    private void initView() {
        tv_total = (TextView) findViewById(R.id.tv_total);
        tv_okrupee = (TextView) findViewById(R.id.tv_okrupee);
        tv_getpaisa = (TextView) findViewById(R.id.tv_getpaisa);
        tv_creditfinch = (TextView) findViewById(R.id.tv_creditfinch);
        tv_paisafinch = (TextView) findViewById(R.id.tv_paisafinch);
        tv_sweetbee = (TextView) findViewById(R.id.tv_sweetbee);
        tv_kracycat = (TextView) findViewById(R.id.tv_kracycat);
        tv_nextcredit = (TextView) findViewById(R.id.tv_nextcredit);
    }

    @SuppressLint("SetTextI18n")
    private void refreshViewData() {
        tv_total.setText("Total: " + totalCount);
        tv_okrupee.setText(mContext.getResources().getString(R.string.enter_okrupee) + ": " + okrupeeCount);
        tv_getpaisa.setText(mContext.getResources().getString(R.string.enter_getpaisa) + ": " + getpaisaCount);
        tv_creditfinch.setText(mContext.getResources().getString(R.string.enter_creditfinch) + ": " + creditfinchCount);
        tv_paisafinch.setText(mContext.getResources().getString(R.string.enter_paisafinch) + ": " + paisafinchCount);
        tv_sweetbee.setText(mContext.getResources().getString(R.string.enter_sweetbee) + ": " + sweetbeeCount);
        tv_kracycat.setText(mContext.getResources().getString(R.string.enter_krazycat) + ": " + kracycatCount);
        tv_nextcredit.setText(mContext.getResources().getString(R.string.enter_nextcredit) + ": " + nextcreditCount);
    }

    /**
     * 初始化控件事件
     *
     * @type method
     * @author liwenjie
     * @creatTime 2019-10-24 13:57
     */
    @SuppressLint("SetTextI18n")
    private void initViewEvent() {
        tv_total.setText("Total: " + totalCount);
        tv_okrupee.setText(mContext.getResources().getString(R.string.enter_okrupee) + ": " + okrupeeCount);
        tv_getpaisa.setText(mContext.getResources().getString(R.string.enter_getpaisa) + ": " + getpaisaCount);
        tv_creditfinch.setText(mContext.getResources().getString(R.string.enter_creditfinch) + ": " + creditfinchCount);
        tv_paisafinch.setText(mContext.getResources().getString(R.string.enter_paisafinch) + ": " + paisafinchCount);
        tv_sweetbee.setText(mContext.getResources().getString(R.string.enter_sweetbee) + ": " + sweetbeeCount);
        tv_kracycat.setText(mContext.getResources().getString(R.string.enter_krazycat) + ": " + kracycatCount);
        tv_nextcredit.setText(mContext.getResources().getString(R.string.enter_nextcredit) + ": " + nextcreditCount);
    }

    public ZHIDialogQueryCount setTotalCount(int totalCount) {
        this.totalCount = totalCount;
        return this;
    }

    public ZHIDialogQueryCount setOkrupeeCount(int okrupeeCount) {
        this.okrupeeCount = okrupeeCount;
        return this;
    }

    public ZHIDialogQueryCount setGetpaisaCount(int getpaisaCount) {
        this.getpaisaCount = getpaisaCount;
        return this;
    }

    public ZHIDialogQueryCount setCreditfinchCount(int creditfinchCount) {
        this.creditfinchCount = creditfinchCount;
        return this;
    }

    public ZHIDialogQueryCount setPaisafinchCount(int paisafinchCount) {
        this.paisafinchCount = paisafinchCount;
        return this;
    }

    public ZHIDialogQueryCount setSweetbeeCount(int sweetbeeCount) {
        this.sweetbeeCount = sweetbeeCount;
        return this;
    }

    public ZHIDialogQueryCount setKracycatCount(int kracycatCount) {
        this.kracycatCount = kracycatCount;
        return this;
    }

    public ZHIDialogQueryCount setNextCreditCount(int nextcreditCount) {
        this.nextcreditCount = nextcreditCount;
        return this;
    }
}
